/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86155
 * date: 2024-03-03
 * Time: 11:45
 *
 * @author 引用
 */

public class TestDate {
    public int year;//年
    public int month;//月
    public int day;//日
//就地初始化
    public String calsses = "bit";
    public int age = 15;

    //不带参数构造方法         //构造方法可以重载


    public TestDate(int year, int month, int day, String calsses, int age) {
        this.year = year;
        this.month = month;
        this.day = day;
        this.calsses = calsses;
        this.age = age;
    }

    public TestDate(){
        //调用本类中的其他构造方法
        this("wangwu",23);
        System.out.println("不带参数构造方法");
    }
    //带参数的构造方法
    public TestDate(String arr,int x){
        System.out.println("带参数的构造方法");
        this.calsses = arr;
        this.age = x;
    }

    public void setDate(int year,int month,int day){
        this.year = year;
        this.month = month;
       this.day = day;
    }
    public void printDate(){
        System.out.println(this.year+"-"+this.month+"-"+this.day);
    }

    public static void main(String[] args) {
        TestDate testDate = new TestDate();
        //TestDate testDate1 = new TestDate("zhangsann",25);
    }

    public static void main2(String[] args) {
        TestDate testDate = new TestDate();
        TestDate testDate1 = new TestDate();
        TestDate testDate2= new TestDate();

        testDate.setDate(2022,2,2);
        testDate1.setDate(2022,2,3);
        testDate2.setDate(2022,2,4);

        testDate.printDate();
        testDate1.printDate();
        testDate2.printDate();


    }
    public static void main1(String[] args) {
        TestDate testDate = new TestDate();
        testDate.setDate(2022,2,2);
        testDate.printDate();
        /*testDate.year = 2022;
        testDate.month = 1;
        testDate.day = 1;*/

        //System.out.println();
    }
}
